<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>药品价格申报（生产企业端）</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>药品价格申报</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">招标采购管理</a></li>
            <li class="active"><a href="#">报价管理</a></li>
            <li class="active"><a href="#">药品价格申报</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                     <div class="form-group form-group-xs">
                        <label>项目名称：</label>
                        <input class="form-control" id=name name="name" type="text" placeholder="项目名称" />
                    </div>
                     
                    <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm"> 查&nbsp;询</button>
                </div>
            </div>
        </div>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
	
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %> 
     <script src="${ctx}/lib/plugins/zTree_v3/js/jquery.ztree.all-3.5.min.js"></script>
    <script type="text/javascript">
        
        $(function () {
            
            $("#gridlist").jqGrid({
                url: "${ctx}/drugPriceQuote/getDrugPriceQuoteProjList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                //shrinkToFit:false,
                height: 270,
                colNames: [ '操作','projId','项目名称',  '简介', '申报开始时间', '申报结束时间','状态'],
                colModel: [
					{ name: 'operate', width: 40 , align:"center" ,sortable: false, 
					    formatter : function(val, opts, rowdata) {
					        var str = "";
					        if(rowdata.endtime >= "${date}"){
					        	str +="<a href='javascript:priceQuote(\""+rowdata.projId+"\",\""+rowdata.name+"\")' >报价</a>";
					        }
					        return str;
					    }
					},
                    { name: 'projId', width: 120 ,hidden:true, align:"center",sortable: false},
                    { name: 'name', width: 140 , align:"left",sortable: false},
                    { name: 'projIntro', width: 150 , align:"left" ,sortable: false},
                    { name: 'starttime', width: 60 , align:"center" ,sortable: false},
                    { name: 'endtime', width: 60 , align:"center" ,sortable: false},
                    { name: 'status', width: 40 ,hidden:true, align:"center" ,sortable: false}
                    
                ],
                rowNum: 20,
                rowList: [10,20,50,100],
                rownumbers: true,
                pager: "#gridpage",
                //multiselect: true, 
                viewrecords: true,
                caption: "采购项目列表",
                jsonReader: {
                    repeatitems: false,
                    id: "projId"
                },
                gridComplete: function(){
                	var page = $("#gridlist").jqGrid('getGridParam','page');
            		var rows = $('#gridlist').getGridParam("rowNum");
            		var maxnum = (rows*page).toString();
            		var len = (maxnum.length)*10;
            		$('.jqgfirstrow').find('td').eq(0).css('width',len+'px');
                	$('#gridlist_rn').css('width',len+'px');
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");  
            
        });
        

        //查询
        function gridSerch() {
            var projCode = $.trim($("#projCode").val());
            var name = $.trim( $("#name").val());
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"projCode":projCode,
                        "name":name}
            }).trigger("reloadGrid"); //重新载入  
        }
        
       function priceQuote(projId,name){
    	   $.post("${ctx}/drugPriceQuote/seePassword.html", {
               "projId" :projId
           }, function(result) {
               if (result.success) {
            	   $.HN.dialog.open({
                       id:"password",
                       title:name,
                       url:" ${ctx}/drugPriceQuote/toWritePassword.html?projId="+projId+"&name="+name,
                       data:{"projId":projId},
                       width:"800px",
                       height:"260px"
                   });
               } else {
                   $.alert(result.msg||"数据异常",  "error");
               }
           }, "json")
    	   
       }
 
    </script>
</body>
</html>